Open
Conversation
…received items from a backend endpoint done. Co-authored-by: Dmytro Khyzhniak <exORYON@users.noreply.github.com>
…Changed files from .js to .ts. Minor improvements in many places.
…-2_Add_product_list. Added check for next page. Minor improvements.
… and "Close" inside.
…essing "Close" button.
…ding of the image in the modal window.
…ixing second half of comments.
…mmand. Use 'npm run lint' to lint your code.
…iew, controller, interface
Comment on lines
+7
to
+8
| const defaultPort:number = parseInt(process.env.PORT || ''); | ||
| const port:number = defaultPort || 5500; |
There was a problem hiding this comment.
const port:number = process.env.PORT || 5500;
Comment on lines
+11
to
+18
| maxPage: number; | ||
| itemsPerPage: number; | ||
|
|
||
| constructor() { | ||
| this.itemsPerPage = 5; | ||
| this.maxPage = 0; | ||
| this.setMaxPage(); | ||
| }; |
There was a problem hiding this comment.
it's not controller responsibility
| result: [], | ||
| }; | ||
|
|
||
| let list: object[] = (await this.getAllItems()).result; |
There was a problem hiding this comment.
object - bad type for interface. need right type
| return response; | ||
| } | ||
|
|
||
| async getItems(req: string):Promise<ResponseObj> { |
There was a problem hiding this comment.
(req: string) - it's not full request
| }; | ||
|
|
||
| let list: object[] = (await this.getAllItems()).result; | ||
| const page: number = parseInt(req); |
Comment on lines
+69
to
+73
| if (this.pageIsNotValid(page)) { | ||
| return false; | ||
| } else { | ||
| return true; | ||
| } |
There was a problem hiding this comment.
as an option
return !this.pageIsNotValid(page);
| view.showSpinner(); | ||
| model.currentList = await model.getDataFromBE(model.currentPage); | ||
|
|
||
| if (model.currentList.length === 0 || model.currentList.length > model.itemsPerPage) { |
There was a problem hiding this comment.
if ( !model.currentList.length || model.currentList.length > model.itemsPerPage) {
| } | ||
| } | ||
| nextPage(): void { | ||
| if (model.currentList.length > 0) { |
There was a problem hiding this comment.
model.currentList.length
Comment on lines
+21
to
+23
| if (list.length === 0) { | ||
| throw new Error('Error. Stock is empty'); | ||
| } |
There was a problem hiding this comment.
if we have length === 0), it's not error
| "@typescript-eslint/parser": "4.22.1", | ||
| "eslint": "7.2.0", | ||
| "eslint-plugin-import": "2.22.1", | ||
| "eslint-plugin-node": "^11.1.0", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We can see the product detail page
When you click on a product in the list of products, a modal window opens with detailed information about the product.
complete information includes:
"add product to cart" - while locked
"close" - closes the model window